﻿Imports System.Data
Imports System.Data.SqlClient
Imports Microsoft.Practices.EnterpriseLibrary.Common
Imports Microsoft.Practices.EnterpriseLibrary.Data


Public Class class_admin

    Private _Log As String
    Public Property log() As String
        Get
            Return _Log
        End Get
        Set(ByVal value As String)
            _Log = value
        End Set
    End Property
    'CRUD AULA'
    Public Sub Insertar_Aula(ByVal modo As String, ByVal numero As Integer, ByVal descripcion As String, ByVal estado As String, ByVal capacidad As Integer, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_aula")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_aula", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "numero", DbType.Int16, numero)
            DB.AddInParameter(cmd, "descripcion", DbType.String, descripcion)
            DB.AddInParameter(cmd, "estado", DbType.String, estado)
            DB.AddInParameter(cmd, "capacidad", DbType.Int16, capacidad)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    Public Sub Modificar_Aula(ByVal modo As String, ByVal id_aula As Integer, ByVal numero As Integer, ByVal descripcion As String, ByVal estado As String, ByVal capacidad As Integer, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_aula")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_aula", DbType.Int16, id_aula)
            DB.AddInParameter(cmd, "numero", DbType.Int16, numero)
            DB.AddInParameter(cmd, "descripcion", DbType.String, descripcion)
            DB.AddInParameter(cmd, "estado", DbType.String, estado)
            DB.AddInParameter(cmd, "capacidad", DbType.Int16, capacidad)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    Public Sub Eliminar_Aula(ByVal modo As String, ByVal id_aula As Integer, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_aula")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_aula", DbType.Int16, id_aula)
            DB.AddInParameter(cmd, "numero", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "descripcion", DbType.String, DBNull.Value)
            DB.AddInParameter(cmd, "estado", DbType.String, DBNull.Value)
            DB.AddInParameter(cmd, "capacidad", DbType.Int16, DBNull.Value)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    'CRUD AULA_EVALUACION'
    Public Sub Insertar_Aula_Evaluacion(ByVal modo As String, ByVal id_evaluacion As Integer, ByVal id_aula As Integer, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_aula_evaluacion")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_aula_evaluacion", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "id_evaluacion", DbType.Int16, id_evaluacion)
            DB.AddInParameter(cmd, "id_aula", DbType.Int16, id_aula)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    Public Sub Modificar_Aula_Evaluacion(ByVal modo As String, ByVal id_aula_evaluacion As Integer, ByVal id_evaluacion As Integer, ByVal id_aula As Integer, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_aula_evaluacion")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_aula_evaluacion", DbType.Int16, id_aula_evaluacion)
            DB.AddInParameter(cmd, "id_evaluacion", DbType.Int16, id_evaluacion)
            DB.AddInParameter(cmd, "id_aula", DbType.Int16, id_aula)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    Public Sub Eliminar_Aula_Evaluacion(ByVal modo As String, ByVal id_aula_evaluacion As Integer, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_aula_evaluacion")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_aula_evaluacion", DbType.Int16, id_aula_evaluacion)
            DB.AddInParameter(cmd, "id_evaluacion", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "id_aula", DbType.Int16, DBNull.Value)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    'CRUD ESTUDIANTE'
    Public Sub Insertar_Estudiante(ByVal modo As String, ByVal CARNET As String, ByVal apellidos As String, ByVal nombres As String, ByVal email As String, ByVal usuario As String, ByVal clave As String, ByVal estado As String, ByVal id_rol As Integer, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_estudiante")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_estudiante", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "CARNET", DbType.String, CARNET)
            DB.AddInParameter(cmd, "apellidos", DbType.String, apellidos)
            DB.AddInParameter(cmd, "nombres", DbType.String, nombres)
            DB.AddInParameter(cmd, "email", DbType.String, email)
            DB.AddInParameter(cmd, "usuario", DbType.String, usuario)
            DB.AddInParameter(cmd, "clave", DbType.String, clave)
            DB.AddInParameter(cmd, "estado", DbType.String, estado)
            DB.AddInParameter(cmd, "id_rol", DbType.Int16, id_rol)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    Public Sub Modificar_Estudiante(ByVal modo As String, ByVal id_estudiante As Integer, ByVal CARNET As String, ByVal apellidos As String, ByVal nombres As String, ByVal email As String, ByVal usuario As String, ByVal clave As String, ByVal estado As String, ByVal id_rol As Integer, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_estudiante")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_estudiante", DbType.Int16, id_estudiante)
            DB.AddInParameter(cmd, "CARNET", DbType.String, CARNET)
            DB.AddInParameter(cmd, "apellidos", DbType.String, apellidos)
            DB.AddInParameter(cmd, "nombres", DbType.String, nombres)
            DB.AddInParameter(cmd, "email", DbType.String, email)
            DB.AddInParameter(cmd, "usuario", DbType.String, usuario)
            DB.AddInParameter(cmd, "clave", DbType.String, clave)
            DB.AddInParameter(cmd, "estado", DbType.String, estado)
            DB.AddInParameter(cmd, "id_rol", DbType.Int16, id_rol)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    Public Sub Eliminar_Estudiante(ByVal modo As String, ByVal id_estudiante As Integer, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_estudiante")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_estudiante", DbType.Int16, id_estudiante)
            DB.AddInParameter(cmd, "CARNET", DbType.String, DBNull.Value)
            DB.AddInParameter(cmd, "apellidos", DbType.String, DBNull.Value)
            DB.AddInParameter(cmd, "nombres", DbType.String, DBNull.Value)
            DB.AddInParameter(cmd, "email", DbType.String, DBNull.Value)
            DB.AddInParameter(cmd, "usuario", DbType.String, DBNull.Value)
            DB.AddInParameter(cmd, "clave", DbType.String, DBNull.Value)
            DB.AddInParameter(cmd, "estado", DbType.String, DBNull.Value)
            DB.AddInParameter(cmd, "id_rol", DbType.Int16, DBNull.Value)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    'CRUD EVALUACION'
    Public Sub Insertar_Evaluacion(ByVal modo As String, ByVal nombre As String, ByVal porcentaje As Integer, ByVal fecha As String, ByVal id_grupo As Integer, ByVal id_tipo_evaluacion As Integer, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_evaluacion")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_evaluacion", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "nombre", DbType.String, nombre)
            DB.AddInParameter(cmd, "porcentaje", DbType.Int16, porcentaje)
            DB.AddInParameter(cmd, "fecha", DbType.String, fecha)
            DB.AddInParameter(cmd, "id_grupo", DbType.Int16, id_grupo)
            DB.AddInParameter(cmd, "id_tipo_evaluacion", DbType.Int16, id_tipo_evaluacion)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    Public Sub Modificar_Evaluacion(ByVal modo As String, ByVal id_evaluacion As Integer, ByVal nombre As String, ByVal porcentaje As Integer, ByVal fecha As String, ByVal id_grupo As Integer, ByVal id_tipo_evaluacion As Integer, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_evaluacion")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_evaluacion", DbType.Int16, id_evaluacion)
            DB.AddInParameter(cmd, "nombre", DbType.String, nombre)
            DB.AddInParameter(cmd, "porcentaje", DbType.Int16, porcentaje)
            DB.AddInParameter(cmd, "fecha", DbType.String, fecha)
            DB.AddInParameter(cmd, "id_grupo", DbType.Int16, id_grupo)
            DB.AddInParameter(cmd, "id_tipo_evaluacion", DbType.Int16, id_tipo_evaluacion)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    Public Sub Eliminar_Evaluacion(ByVal modo As String, ByVal id_evaluacion As Integer, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_evaluacion")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_evaluacion", DbType.Int16, id_evaluacion)
            DB.AddInParameter(cmd, "nombre", DbType.String, DBNull.Value)
            DB.AddInParameter(cmd, "porcentaje", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "fecha", DbType.String, DBNull.Value)
            DB.AddInParameter(cmd, "id_grupo", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "id_tipo_evaluacion", DbType.Int16, DBNull.Value)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    'CRUD GRUPO'
    Public Sub Insertar_Grupo(ByVal modo As String, ByVal numero As Integer, ByVal id_materia As Integer, ByVal id_aula As Integer, ByVal id_horario As Integer, ByVal id_personal As Integer, ByVal dia As String, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_grupo")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_grupo", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "numero", DbType.Int16, numero)
            DB.AddInParameter(cmd, "id_materia", DbType.Int16, id_materia)
            DB.AddInParameter(cmd, "id_aula", DbType.Int16, id_aula)
            DB.AddInParameter(cmd, "id_horario", DbType.Int16, id_horario)
            DB.AddInParameter(cmd, "id_personal", DbType.Int16, id_personal)
            DB.AddInParameter(cmd, "dia", DbType.String, dia)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    Public Sub Modificar_Grupo(ByVal modo As String, ByVal id_grupo As Integer, ByVal numero As Integer, ByVal id_materia As Integer, ByVal id_aula As Integer, ByVal id_horario As Integer, ByVal id_personal As Integer, ByVal dia As String, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_grupo")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_grupo", DbType.Int16, id_grupo)
            DB.AddInParameter(cmd, "numero", DbType.Int16, numero)
            DB.AddInParameter(cmd, "id_materia", DbType.Int16, id_materia)
            DB.AddInParameter(cmd, "id_aula", DbType.Int16, id_aula)
            DB.AddInParameter(cmd, "id_horario", DbType.Int16, id_horario)
            DB.AddInParameter(cmd, "id_personal", DbType.Int16, id_personal)
            DB.AddInParameter(cmd, "dia", DbType.String, dia)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    Public Sub Eliminar_Grupo(ByVal modo As String, ByVal id_grupo As Integer, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_grupo")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_grupo", DbType.Int16, id_grupo)
            DB.AddInParameter(cmd, "numero", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "id_materia", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "id_aula", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "id_horario", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "id_personal", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "dia", DbType.String, DBNull.Value)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    'CRUD GRUPO TEORICO'
    Public Sub Insertar_Grupo_Teorico(ByVal modo As String, ByVal id_materia As Integer, ByVal id_personal As Integer, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_grupo_teorico")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_grupo_teorico", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "id_materia", DbType.Int16, id_materia)
            DB.AddInParameter(cmd, "id_personal", DbType.Int16, id_personal)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    Public Sub Modificar_Grupo_Teorico(ByVal modo As String, ByVal id_grupo_teorico As Integer, ByVal id_materia As Integer, ByVal id_personal As Integer, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_grupo_teorico")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_grupo_teorico", DbType.Int16, id_grupo_teorico)
            DB.AddInParameter(cmd, "id_materia", DbType.Int16, id_materia)
            DB.AddInParameter(cmd, "id_personal", DbType.Int16, id_personal)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    Public Sub Eliminar_Grupo_Teorico(ByVal modo As String, ByVal id_grupo_teorico As Integer, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_grupo_teorico")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_grupo_teorico", DbType.Int16, id_grupo_teorico)
            DB.AddInParameter(cmd, "id_materia", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "id_personal", DbType.Int16, DBNull.Value)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    'CRUD HORARIO' 
    Public Sub Insertar_Horario(ByVal modo As String, ByVal hora_inicio As String, ByVal hora_fin As String, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_horario")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_horario", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "hora_inicio", DbType.String, hora_inicio)
            DB.AddInParameter(cmd, "hora_fin", DbType.String, hora_fin)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    Public Sub Modificar_Horario(ByVal modo As String, ByVal id_horario As Integer, ByVal hora_inicio As String, ByVal hora_fin As String, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_horario")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_horario", DbType.Int16, id_horario)
            DB.AddInParameter(cmd, "hora_inicio", DbType.String, hora_inicio)
            DB.AddInParameter(cmd, "hora_fin", DbType.String, hora_fin)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    Public Sub Eliminar_Horario(ByVal modo As String, ByVal id_horario As Integer, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_horario")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_horario", DbType.Int16, id_horario)
            DB.AddInParameter(cmd, "hora_inicio", DbType.String, DBNull.Value)
            DB.AddInParameter(cmd, "hora_fin", DbType.String, DBNull.Value)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    'CRUD INSCRIPCION'
    Public Sub Insertar_Inscripcion(ByVal modo As String, ByVal id_estudiante As Integer, ByVal id_grupo As Integer, ByVal ciclo As Integer, ByVal anio As Integer, ByVal id_personal As Integer, ByVal id_grupo_teorico As Integer, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_inscripcion")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_inscripcion", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "id_estudiante", DbType.Int16, id_estudiante)
            DB.AddInParameter(cmd, "id_grupo", DbType.Int16, id_grupo)
            DB.AddInParameter(cmd, "ciclo", DbType.Int16, ciclo)
            DB.AddInParameter(cmd, "anio", DbType.Int16, anio)
            DB.AddInParameter(cmd, "id_personal", DbType.Int16, id_personal)
            DB.AddInParameter(cmd, "id_grupo_teorico", DbType.Int16, id_grupo_teorico)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    Public Sub Modificar_Inscripcion(ByVal modo As String, ByVal id_inscripcion As Integer, ByVal id_estudiante As Integer, ByVal id_grupo As Integer, ByVal ciclo As Integer, ByVal anio As Integer, ByVal id_personal As Integer, ByVal id_grupo_teorico As Integer, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_inscripcion")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_inscripcion", DbType.Int16, id_inscripcion)
            DB.AddInParameter(cmd, "id_estudiante", DbType.Int16, id_estudiante)
            DB.AddInParameter(cmd, "id_grupo", DbType.Int16, id_grupo)
            DB.AddInParameter(cmd, "ciclo", DbType.Int16, ciclo)
            DB.AddInParameter(cmd, "anio", DbType.Int16, anio)
            DB.AddInParameter(cmd, "id_personal", DbType.Int16, id_personal)
            DB.AddInParameter(cmd, "id_grupo_teorico", DbType.Int16, id_grupo_teorico)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    Public Sub Eliminar_Inscripcion(ByVal modo As String, ByVal id_inscripcion As Integer, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_inscripcion")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_inscripcion", DbType.Int16, id_inscripcion)
            DB.AddInParameter(cmd, "id_estudiante", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "id_grupo", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "ciclo", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "anio", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "id_personal", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "id_grupo_teorico", DbType.Int16, DBNull.Value)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    'CRUD  MATERIA'
    Public Sub Insertar_Materia(ByVal modo As String, ByVal codigo As String, ByVal nombre As String, ByVal estado As String, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_materia")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_materia", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "codigo", DbType.String, codigo)
            DB.AddInParameter(cmd, "nombre", DbType.String, nombre)
            DB.AddInParameter(cmd, "estado", DbType.String, estado)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    Public Sub Modificar_Materia(ByVal modo As String, ByVal id_materia As Integer, ByVal codigo As String, ByVal nombre As String, ByVal estado As String, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_materia")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_materia", DbType.Int16, id_materia)
            DB.AddInParameter(cmd, "codigo", DbType.String, codigo)
            DB.AddInParameter(cmd, "nombre", DbType.String, nombre)
            DB.AddInParameter(cmd, "estado", DbType.String, estado)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    Public Sub Eliminar_Materia(ByVal modo As String, ByVal id_materia As Integer, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_materia")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_materia", DbType.Int16, id_materia)
            DB.AddInParameter(cmd, "codigo", DbType.String, DBNull.Value)
            DB.AddInParameter(cmd, "nombre", DbType.String, DBNull.Value)
            DB.AddInParameter(cmd, "estado", DbType.String, DBNull.Value)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    'CRUD NOTA'
    Public Sub Insertar_Nota(ByVal modo As String, ByVal nota As Integer, ByVal id_inscripcion As Integer, ByVal id_evaluacion As Integer, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_nota")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_nota", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "nota", DbType.Int16, nota)
            DB.AddInParameter(cmd, "id_inscripcion", DbType.Int16, id_inscripcion)
            DB.AddInParameter(cmd, "id_evaluacion", DbType.Int16, id_evaluacion)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    Public Sub Modificar_Nota(ByVal modo As String, ByVal id_nota As Integer, ByVal nota As Integer, ByVal id_inscripcion As Integer, ByVal id_evaluacion As Integer, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_nota")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_nota", DbType.Int16, id_nota)
            DB.AddInParameter(cmd, "nota", DbType.Int16, nota)
            DB.AddInParameter(cmd, "id_inscripcion", DbType.Int16, id_inscripcion)
            DB.AddInParameter(cmd, "id_evaluacion", DbType.Int16, id_evaluacion)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    Public Sub Eliminar_Nota(ByVal modo As String, ByVal id_nota As Integer, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_nota")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_nota", DbType.Int16, id_nota)
            DB.AddInParameter(cmd, "nota", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "id_inscripcion", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "id_evaluacion", DbType.Int16, DBNull.Value)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    'CRUD PERMISO'
    Public Sub Insertar_Permiso(ByVal modo As String, ByVal id_pagina As Integer, ByVal id_rol As Integer, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_permiso")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_permiso", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "id_pagina", DbType.Int16, id_pagina)
            DB.AddInParameter(cmd, "id_rol", DbType.Int16, id_rol)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    Public Sub Modificar_Permiso(ByVal modo As String, ByVal id_permiso As Integer, ByVal id_pagina As Integer, ByVal id_rol As Integer, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_permiso")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_permiso", DbType.Int16, id_permiso)
            DB.AddInParameter(cmd, "id_pagina", DbType.Int16, id_pagina)
            DB.AddInParameter(cmd, "id_rol", DbType.Int16, id_rol)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    Public Sub Eliminar_Permiso(ByVal modo As String, ByVal id_permiso As Integer, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_permiso")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_permiso", DbType.Int16, id_permiso)
            DB.AddInParameter(cmd, "id_pagina", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "id_rol", DbType.Int16, DBNull.Value)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try

    End Sub
    'CRUD ROL'
    Public Sub Insertar_Rol2(ByVal nombreapp As String, ByVal rol As String, ByVal descriccion As String, ByVal errore As Integer)
        Try

            Dim db As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = db.GetStoredProcCommand("aspnet_Roles_CreateRoleUFG")
            db.AddInParameter(cmd, "@ApplicationName", DbType.String, nombreapp)
            db.AddInParameter(cmd, "@RoleName", DbType.String, rol)
            db.AddInParameter(cmd, "@Descripcion", DbType.String, descriccion)
            db.AddOutParameter(cmd, "@VALOR", DbType.Int32, errore)
            db.ExecuteNonQuery(cmd)
            _Log = db.GetParameterValue(cmd, "@VALOR")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try
    End Sub
    Public Sub Modificar_Rol2(ByVal nombreapp As String, ByVal rol As String, ByVal descriccion As String, ByVal errore As Integer)
        Try
            'MODIFICICAR
            Dim db As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = db.GetStoredProcCommand("")
            db.AddInParameter(cmd, "@ApplicationName", DbType.String, nombreapp)
            db.AddInParameter(cmd, "@RoleName", DbType.String, rol)
            db.AddInParameter(cmd, "@Descripcion", DbType.String, descriccion)
            db.AddOutParameter(cmd, "@VALOR", DbType.Int32, errore)
            db.ExecuteNonQuery(cmd)
            _Log = db.GetParameterValue(cmd, "@VALOR")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try
    End Sub
    'Public Sub Insertar_Rol(ByVal modo As String, ByVal nombre As String, ByVal descripcion As String, ByVal errore As Integer)
    '    Try
    '        Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
    '        Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_rol")
    '        DB.AddInParameter(cmd, "modo", DbType.String, modo)
    '        DB.AddInParameter(cmd, "id_rol", DbType.Int16, DBNull.Value)
    '        DB.AddInParameter(cmd, "nombre", DbType.String, nombre)
    '        DB.AddInParameter(cmd, "descripcion", DbType.String, descripcion)
    '        DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
    '        DB.ExecuteNonQuery(cmd)
    '        _Log = DB.GetParameterValue(cmd, "error")

    '    Catch exc As SqlException
    '        MsgBox(exc.Message, MsgBoxStyle.Critical)
    '    Catch ex As Exception
    '        MsgBox(ex.Message, MsgBoxStyle.Critical)
    '    End Try
    'End Sub

    'Public Sub Modificar_Rol(ByVal modo As String, ByVal id_rol As Integer, ByVal nombre As String, ByVal descripcion As String, ByVal errore As Integer)
    '    Try
    '        Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
    '        Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_rol")
    '        DB.AddInParameter(cmd, "modo", DbType.String, modo)
    '        DB.AddInParameter(cmd, "id_rol", DbType.Int16, id_rol)
    '        DB.AddInParameter(cmd, "nombre", DbType.String, nombre)
    '        DB.AddInParameter(cmd, "descripcion", DbType.String, descripcion)
    '        DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
    '        DB.ExecuteNonQuery(cmd)
    '        _Log = DB.GetParameterValue(cmd, "error")

    '    Catch exc As SqlException
    '        MsgBox(exc.Message, MsgBoxStyle.Critical)
    '    Catch ex As Exception
    '        MsgBox(ex.Message, MsgBoxStyle.Critical)
    '    End Try
    'End Sub

    Public Sub Eliminar_Rol(ByVal appname As String, ByVal rolename As String, ByVal validauser_rol As Integer)
        Try
            Dim db As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = db.GetStoredProcCommand("aspnet_Roles_DeleteRole")
            db.AddInParameter(cmd, "@ApplicationName", DbType.String, appname)
            db.AddInParameter(cmd, "@RoleName", DbType.String, rolename)
            db.AddInParameter(cmd, "@DeleteOnlyIfRoleIsEmpty", DbType.Byte, validauser_rol)
            _Log = db.ExecuteNonQuery(cmd)

            'Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            'Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_rol")
            'DB.AddInParameter(cmd, "modo", DbType.String, modo)
            'DB.AddInParameter(cmd, "id_rol", DbType.Int16, id_rol)
            'DB.AddInParameter(cmd, "nombre", DbType.String, DBNull.Value)
            'DB.AddInParameter(cmd, "descripcion", DbType.String, DBNull.Value)
            'DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            'DB.ExecuteNonQuery(cmd)
            '_Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try
    End Sub
    'CRUD PERSONAL'
    Public Sub Insertar_Personal(ByVal modo As String, ByVal CARNET As Integer, ByVal apellidos As String, ByVal nombres As String, ByVal email As String, ByVal telefono As String, ByVal usuario As String, ByVal clave As String, ByVal estado As String, ByVal id_rol As Integer, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_personal")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_personal", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "CARNET", DbType.Int32, CARNET)
            DB.AddInParameter(cmd, "apellidos", DbType.String, apellidos)
            DB.AddInParameter(cmd, "nombres", DbType.String, nombres)
            DB.AddInParameter(cmd, "email", DbType.String, email)
            DB.AddInParameter(cmd, "telefono", DbType.String, telefono)
            DB.AddInParameter(cmd, "usuario", DbType.String, usuario)
            DB.AddInParameter(cmd, "clave", DbType.String, clave)
            DB.AddInParameter(cmd, "estado", DbType.String, estado)
            DB.AddInParameter(cmd, "id_rol", DbType.Int16, id_rol)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try
    End Sub
    Public Sub Modificar_Personal(ByVal modo As String, ByVal id_personal As Integer, ByVal CARNET As Integer, ByVal apellidos As String, ByVal nombres As String, ByVal email As String, ByVal telefono As String, ByVal usuario As String, ByVal clave As String, ByVal estado As String, ByVal id_rol As Integer, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_personal")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_personal", DbType.Int16, id_personal)
            DB.AddInParameter(cmd, "CARNET", DbType.Int32, CARNET)
            DB.AddInParameter(cmd, "apellidos", DbType.String, apellidos)
            DB.AddInParameter(cmd, "nombres", DbType.String, nombres)
            DB.AddInParameter(cmd, "email", DbType.String, email)
            DB.AddInParameter(cmd, "telefono", DbType.String, telefono)
            DB.AddInParameter(cmd, "usuario", DbType.String, usuario)
            DB.AddInParameter(cmd, "clave", DbType.String, clave)
            DB.AddInParameter(cmd, "estado", DbType.String, estado)
            DB.AddInParameter(cmd, "id_rol", DbType.Int16, id_rol)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try
    End Sub
    Public Sub Eliminar_Personal(ByVal modo As String, ByVal id_personal As Integer, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_personal")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_personal", DbType.Int16, id_personal)
            DB.AddInParameter(cmd, "CARNET", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "apellidos", DbType.String, DBNull.Value)
            DB.AddInParameter(cmd, "nombres", DbType.String, DBNull.Value)
            DB.AddInParameter(cmd, "email", DbType.String, DBNull.Value)
            DB.AddInParameter(cmd, "telefono", DbType.String, DBNull.Value)
            DB.AddInParameter(cmd, "usuario", DbType.String, DBNull.Value)
            DB.AddInParameter(cmd, "clave", DbType.String, DBNull.Value)
            DB.AddInParameter(cmd, "estado", DbType.String, DBNull.Value)
            DB.AddInParameter(cmd, "id_rol", DbType.Int16, DBNull.Value)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try
    End Sub
    'CRUD TIPO_EVALUACION'
    Public Sub Insertar_Tipo_Evaluacion(ByVal modo As String, ByVal nombre As String, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_tipo_evaluacion")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_tipo_evaluacion", DbType.Int16, DBNull.Value)
            DB.AddInParameter(cmd, "nombre", DbType.String, nombre)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try
    End Sub
    Public Sub Modificar_Tipo_Evaluacion(ByVal modo As String, ByVal id_tipo_evaluacion As Integer, ByVal nombre As String, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_tipo_evaluacion")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_tipo_evaluacion", DbType.Int16, id_tipo_evaluacion)
            DB.AddInParameter(cmd, "nombre", DbType.String, nombre)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try
    End Sub
    Public Sub Eliminar_Tipo_Evaluacion(ByVal modo As String, ByVal id_tipo_evaluacion As String, ByVal errore As Integer)
        Try
            Dim DB As Database = DatabaseFactory.CreateDatabase("ASI2UFG")
            Dim cmd As Common.DbCommand = DB.GetStoredProcCommand("sp_tipo_evaluacion")
            DB.AddInParameter(cmd, "modo", DbType.String, modo)
            DB.AddInParameter(cmd, "id_tipo_evaluacion", DbType.Int16, id_tipo_evaluacion)
            DB.AddInParameter(cmd, "nombre", DbType.String, DBNull.Value)
            DB.AddOutParameter(cmd, "error", DbType.Int16, 5)
            DB.ExecuteNonQuery(cmd)
            _Log = DB.GetParameterValue(cmd, "error")

        Catch exc As SqlException
            MsgBox(exc.Message, MsgBoxStyle.Critical)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try
    End Sub

End Class
